<template>
  <x-popup @close="onClose" type="center" title="订单二维码" height="auto" v-model="show">
    <view class="x-padding-30 x-column">
<!--      <x-qrcode :data="qrcodeUrl"></x-qrcode>-->

<!--      <view class="open x-normal-top">打开支付宝<text class="bold">[扫一扫]</text></view>-->
      <img :src="qrcodeUrl" style="width: 547rpx;height: 667rpx">
      <view class="order-no x-normal-top">订单编号：{{orderNo}}</view>
    </view>
  </x-popup>
</template>

<script setup name="x-order-qrcode">
import XPopup from '@/components/lib/popup'
import XQrcode from '@/components/lib/qrcode'
import orderStore from '@/stores/modules/order';
const OrderStore = orderStore();
import {Helper, Log} from 'core';
const show = ref(false);
const orderNo = ref("")
const qrcodeUrl = ref("")
const open = async (no) => {
  show.value = true;
  orderNo.value = no;
  qrcodeUrl.value = await OrderStore.getQrcode(orderNo.value);
  Log.info("订单二维码", qrcodeUrl.value);
  if(Helper.empty(qrcodeUrl.value)) {
    show.value = false;
  }
}

defineExpose({open});

const emit = defineEmits(['emit']);
const onClose = () => {
  emit("close");
}

</script>

<style scoped lang="less">
.open {
  font-size: 48rpx;
  color: #5098F5;
  text-align: center;

  .bold {
    font-weight: bold;
  }
}

.order-no {
  text-align: center;
  color: #999999;
  font-size: 24rpx;
}
</style>
